package org.jcc.core.cs.generic.bigger;

public class GenericBigger {
	
	public static <C extends Comparable<C>> C bigger(C c1, C c2) {
		return c1.compareTo(c2) > 0 ? c1 : c2;
	}
	
	public static void main(String[] args) {
		String biggerString = bigger("hello", "hi");
		Integer biggerInteger = bigger(new Integer(8), new Integer(5));
		System.out.println(biggerString);
		System.out.println(biggerInteger);
		
		Bird longerBird = bigger(new Bird("18cm"), new Bird("12cm"));
		Ball biggerBall = bigger(new Ball("A Cup"), new Ball("D Cup"));
		System.out.println(longerBird);
		System.out.println(biggerBall);

	}

}
